﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Web;
using System.IO;
using System.Net;
using System.Threading;
using System.ServiceModel;
using System.ServiceModel.Description;

namespace RunGate
{
    public partial class RunGateDlg : Form
    {
        public static string ServerIP = "127.0.0.1";
        public static int GatePort = 542;
        public static int ServerPort = 541;

        public RunGateDlg()
        {
            InitializeComponent();
        }

        private void RunGate_Load(object sender, EventArgs e)
        {
            TCPConnectionService TCPRunGate = new TCPConnectionService();
            if (TCPRunGate.Connect(ServerIP, GatePort, ServerPort))
            {
                AddLogMessage("Connected...");
                AddLogMessage("Listening on Port: " + GatePort.ToString());
            }
            else
            {
                AddLogMessage("Could not connect...");
            }
        }

        public void AddLogMessage(string message)
        {
            if (message != "")
            {
                LogList.Items.Add("[" + DateTime.Now.ToUniversalTime().ToString() + "] - " + message);
            }
        }

        private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            RunGateSettings RunGateForm = new RunGateSettings();
            RunGateForm.Show();
        }
    }
}
